Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 20170321 x64call #149

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

pult
Copy link

@pult pult commented Mar 21, 2017

Fixed x64call cause GPF when exception.
Added pure pascal vesion of "x64call".

Added sample "console_rops":

  • sample: {$i inc-file}
  • sample: params 7, 64
  • sample: raise exception ( procedure RaiseExceptionMessage )
  • sample: show current exception: text,file,position
  • sample: emulate reserved word "raise" ( raise current exception )

Fixed x64call cause GPF when exception.
Added pure pascal vesion.
- sample: {$i inc-file}
- sample: params 7, 64
- sample: raise exception ( procedure RaiseExceptionMessage )
- sample: show current exception: text,file,position
- sample: emulate reserved word "raise" ( raise current exception )
- TODO: AV: FPC X64 OPENARRAY ( sample "format('%s; %s',['2','2'])" )
@carlokok
Copy link
Member

This seems to completely reformat all files, I can't see what actually changed?

@pult
Copy link
Author

pult commented Mar 21, 2017

A few blank double lines were deleted.

@carlokok
Copy link
Member

I'm sorry; I can't accept a pull request that reformats > 500 lines and also does functionality changes. It would completely break the git history

@pult
Copy link
Author

pult commented Mar 21, 2017

"functionality changes" do not change, but only fixed.

@pult
Copy link
Author

pult commented Mar 21, 2017

Base code is very poorly formatted (tabs, trailed spaces, duplicated blank lines, line breaks in class declarations). :(

@pult
Copy link
Author

pult commented Mar 21, 2017

"Beyond compare" can ignore the insignificant differences in formatting.

@albertozen2
Copy link

Tested, it works fine for me. Thanks

@albertozen2
Copy link

Errata corrige

There is a problem with function with args and an extended value as result

Program test;
var
AValue : Extended;
begin
AValue := StrToDate('10/10/2017');
writeln(DateToStr(AValue));
end.

the result of StrToDate is always 30/12/1899

@david-navigator
Copy link

david-navigator commented Nov 6, 2019

Although @pult fix for GPF is brilliant and I'm not sure why it's not in the main branch, though as @albertozen2 detailed it stops any functions that return an extended value in the result from working - they don't need to have arguments, something like NOW just returns 30/12/1899.
Has anyone found a fix for this major issue ?

@albertozen2
Copy link

i commented two lines into x64.inc code file.

movsd xmm0,[RegInfo].TRegisters._RCX
movsd xmm1,[RegInfo].TRegisters._RDX

@david-navigator
Copy link

i commented two lines into x64.inc code file.

movsd xmm0,[RegInfo].TRegisters._RCX movsd xmm1,[RegInfo].TRegisters._RDX

Thanks @albertozen2 do you mean you removed them from x64.inc like this ?

@@skip_items:

// mov , [r9]. ; [r9] == [RegInfo]
mov rcx, [RegInfo].TRegisters._RCX
mov rdx, [RegInfo].TRegisters._RDX
mov r8, [RegInfo].TRegisters._R8

// movsd xmm0,[RegInfo].TRegisters._RCX
// movsd xmm1,[RegInfo].TRegisters._RDX
movsd xmm2,[RegInfo].TRegisters._R8
movsd xmm3,[RegInfo].TRegisters._R9

For me the result of StrToDate is still 30/12/1899 :(
Have I understood wrongly ?

@albertozen2
Copy link

I report the full code block. The commented lines are bold
The code is between line 591 and line 610 (in my x64.inc).
I hope that change can help you

{
Alberto Zen 20/03/2018
movsd xmm0,[RegInfo].TRegisters._RCX
movsd xmm1,[RegInfo].TRegisters._RDX
}

movsd xmm2,[RegInfo].TRegisters._R8
movsd xmm3,[RegInfo].TRegisters._R9

mov r9, [RegInfo].TRegisters._R9 // !!! Overwritten RegInfo (r9)

call [rbp+c_loc_offs_adress]

// make result
mov rdx, [rbp+c_loc_offs__rax] // restore: rdx (@_RDX)
mov [rdx], RAX // fill: _RAX

{
Alberto Zen 20/03/2018
movsd [rdx+c_sz_ptr], XMM0 // fill: _XMM0
}

@david-navigator
Copy link

i commented two lines into x64.inc code file.

movsd xmm0,[RegInfo].TRegisters._RCX movsd xmm1,[RegInfo].TRegisters._RDX

Do you mean you added to extra lines ? If so where do they go ?

I report the full code block. The commented lines are bold
The code is between line 591 and line 610 (in my x64.inc).
I hope that change can help you

{ Alberto Zen 20/03/2018 movsd xmm0,[RegInfo].TRegisters._RCX movsd xmm1,[RegInfo].TRegisters._RDX }
movsd xmm2,[RegInfo].TRegisters._R8
movsd xmm3,[RegInfo].TRegisters._R9

mov r9, [RegInfo].TRegisters._R9 // !!! Overwritten RegInfo (r9)

call [rbp+c_loc_offs_adress]

// make result
mov rdx, [rbp+c_loc_offs__rax] // restore: rdx (@_RDX)
mov [rdx], RAX // fill: _RAX

{ Alberto Zen 20/03/2018 movsd [rdx+c_sz_ptr], XMM0 // fill: _XMM0 }

I have copied you code exactly, but for me the result is still 30/12/1899 :(

@albertozen2
Copy link

Sorry, i looked for in my repository but i didn't find other changes.
Have you rebuilt the package?

@david-navigator
Copy link

Sorry, i looked for in my repository but i didn't find other changes.
Have you rebuilt the package?

I'm not using packages, code is just compiled in to my app. I've confirmed that the updated x64.inc file is being compiled.
Not sure I understand the code well enough to debug further without some help.
Are you using Delphi Rio too ?

@albertozen2
Copy link

No, Berlin

@pult
Copy link
Author

pult commented Dec 31, 2019

x64.inc new fixes

@CPsoftBE
Copy link

Thank You, now it works :-)

@albertozen2
Copy link

@pult , your branch works, the official doesn't :-)
this script in official branch of PascalScript doesn't work
**_

program main;
var
myDate : TDateTime;
abuf : string;
begin
myDate := StrToDate('25/09/2020');
aBuf := DateTostr(myDate);
end.

_**
It raises an exception.

@carlokok
Copy link
Member

@pult you feel like checking the conflicts? I'll try to merge this next week (I do have to dig into the changes though, I see a lot of changes not relevant to this change, and I have to check them 1 by one).

@david-navigator
Copy link

@pult @carlokok @albertozen2
Did this get merged in to the master ?
Not sure what I need to Get to build under Sydney ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants